[PV-on-HVM] Make PV drivers on HVM kernels work on older kernels after
authorIan Campbell <ian.campbell@xensource.com>
Mon, 22 Jan 2007 17:10:27 +0000 (17:10 +0000)
committerIan Campbell <ian.campbell@xensource.com>
Mon, 22 Jan 2007 17:10:27 +0000 (17:10 +0000)
update to 2.6.18.

Signed-off-by: Ian Campbell <ian.campbell@xensource.com>
linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c
linux-2.6-xen-sparse/drivers/xen/core/gnttab.c
unmodified_drivers/linux-2.6/compat-include/xen/platform-compat.h
unmodified_drivers/linux-2.6/platform-pci/platform-pci.c

index 1a91f27a147482afceffe75c808d4ca534b16e83..39b40d835ffa7f7e12ee039d57ecec0a18642929 100644 (file)
@@ -272,13 +272,21 @@ static void backend_changed(struct xenbus_device *dev,
                if (bd == NULL)
                        xenbus_dev_fatal(dev, -ENODEV, "bdget failed");
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,17)
+               down(&bd->bd_sem);
+#else
                mutex_lock(&bd->bd_mutex);
+#endif
                if (info->users > 0)
                        xenbus_dev_error(dev, -EBUSY,
                                         "Device in use; refusing to close");
                else
                        blkfront_closing(dev);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,17)
+               up(&bd->bd_sem);
+#else
                mutex_unlock(&bd->bd_mutex);
+#endif
                bdput(bd);
                break;
        }
index c5132c13bb68d4bb5d3e2a780fd3323459f1d570..1cab1d822b6c7ef676c605b57ffc78b5bba4d802 100644 (file)
@@ -464,7 +464,7 @@ int gnttab_suspend(void)
 
 #endif /* !CONFIG_XEN */
 
-int __init gnttab_init(void)
+int __devinit gnttab_init(void)
 {
        int i;
 
index 4a5aa7f9f9c6a2c35f137569da3006e7978b4f7c..87db7bf3d085370746861b07b79cedbd85eb2649 100644 (file)
 #define gfp_t unsigned
 #endif
 
+#if defined (_LINUX_NOTIFIER_H) && !defined ATOMIC_NOTIFIER_HEAD
+#define ATOMIC_NOTIFIER_HEAD(name) struct notifier_block *name
+#define atomic_notifier_chain_register(chain,nb) notifier_chain_register(chain,nb)
+#define atomic_notifier_chain_unregister(chain,nb) notifier_chain_unregister(chain,nb)
+#define atomic_notifier_call_chain(chain,val,v) notifier_call_chain(chain,val,v)
+#endif
+
 #if defined(_LINUX_FS_H) && LINUX_VERSION_CODE < KERNEL_VERSION(2,6,9)
 #define nonseekable_open(inode, filp) /* Nothing to do */
 #endif
@@ -69,4 +76,8 @@ extern char *kasprintf(gfp_t gfp, const char *fmt, ...)
        __attribute__ ((format (printf, 2, 3)));
 #endif
 
+#if defined(_I386_PAGE_H) && defined(CONFIG_X86_PAE)
+#define __supported_pte_mask ~0ULL
+#endif
+
 #endif
index 321a166d0596051fe162bd134357ea307121d581..7973f8682085c7e017929975865cc14ae3d66fb6 100644 (file)
@@ -61,7 +61,7 @@ MODULE_LICENSE("GPL");
 unsigned long *phys_to_machine_mapping;
 EXPORT_SYMBOL(phys_to_machine_mapping);
 
-static int __init init_xen_info(void)
+static int __devinit init_xen_info(void)
 {
        unsigned long shared_info_frame;
        struct xen_add_to_physmap xatp;
@@ -194,14 +194,23 @@ static uint64_t get_callback_via(struct pci_dev *pdev)
               rid);
        return rid | IA64_CALLBACK_IRQ_RID;
 #else /* !__ia64__ */
+       u8 pin;
+
        if (pdev->irq < 16)
                return pdev->irq; /* ISA IRQ */
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
+       pin = pdev->pin;
+#else
+       pci_read_config_byte(pdev, PCI_INTERRUPT_PIN, &pin);
+#endif
+
        /* We don't know the GSI. Specify the PCI INTx line instead. */
        return (((uint64_t)0x01 << 56) | /* PCI INTx identifier */
                ((uint64_t)pci_domain_nr(pdev->bus) << 32) |
                ((uint64_t)pdev->bus->number << 16) |
                ((uint64_t)(pdev->devfn & 0xff) << 8) |
-               ((uint64_t)(pdev->pin - 1) & 3));
+               ((uint64_t)(pin - 1) & 3));
 #endif
 }